#!/bin/bash
sleep 10
while true
do
var=$(sed -n 1p /home/nuc/robomaster2021/status.log)
if test $var != $"everything_OK";then
	current_time=$(date)
	echo $current_time>>/home/nuc/robomaster2021/ERROR.log
	echo "Program Break Down">>/home/nuc/robomaster2021/ERROR.log
	echo Program Break Down
	pkill Robomaster2020
	bash /home/nuc/robomaster2021/Robomaster2020/reopen.sh
	sleep 3
	#exit
else
	echo everything_OK 
	echo "1">>/home/nuc/robomaster2021/status.log
	sleep 1
fi
done
